package com.example.business_oa.controller;


import com.example.business_oa.service.HyJobService;
import com.example.business_oa.service.QiDongGangweixuqiuService;
import com.example.business_oa.service.QiDongYuSuanZhuiJiaService;
import com.example.business_oa.service.SelectLeaderService;
import com.example.comment_oa.pojos.Jobrequirements;
import com.example.comment_oa.pojos.SysEmployee;
import com.example.comment_oa.response.AjaxResponse;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.HashMap;

@RestController
@CrossOrigin
@RequestMapping("/businessOa")
public class QiDongGangweixuqiuController {

    @Resource
    QiDongGangweixuqiuService qiDongGangweixuqiuService;
    @Resource
    HyJobService hyJobService;
    @Resource
    SelectLeaderService selectLeaderService;

    @PostMapping("/qidongGangweixuqiu")
    public AjaxResponse qidongGangweixuqiu(@RequestBody Jobrequirements job){
        int addjob = hyJobService.addjob(job);
        String gonghao = job.getJobGonghao();
        String bianhao = job.getJobBianhao();
        //这个是关于流程的
        HashMap<String, Object> variables = new HashMap<>();
        SysEmployee sysEmployee = selectLeaderService.selectGongHao(gonghao);
        String assignee1 = sysEmployee.getEmpCard();
        //要一个工号 ：是发起人的
        // 一个编号 是 ：主键

       qiDongGangweixuqiuService.qidongGangweixuqiu(gonghao,variables,assignee1,bianhao);
        return AjaxResponse.success(addjob);
    }
}
